package com.feilong.cn.mybatis.autoV2.plugin;

import com.feilong.cn.mybatis.autoV2.executor.BaseExecutor;
import com.feilong.cn.mybatis.autoV2.executor.IExecutor;
import com.feilong.cn.mybatis.autoV2.mappers.IUserMapper;
import org.apache.ibatis.plugin.Invocation;

import java.util.Properties;

/**
 * Created by yangxulong on 2018/4/9.
 */
@AutoIntercepts({@AutoSignature(
        type =  IExecutor.class,
        method = "doQuery",
        args = {String.class, Object.class}
)})
public class AutoSelfPluginDemo implements AutoInterceptor {
    @Override
    public Object intercept(Invocation invocation) throws Throwable {
        System.out.println("plugin method Before .");
        Object object = invocation.proceed();
        System.out.println("plugin method After .");
        return object;
    }

    @Override
    public Object plugin(Object target) {
        return AutoPlugin.Warp(target, this);
    }

    @Override
    public void setProperties(Properties properties) {

    }
}
